#ifndef __BUOLA_GUI_CCONFIG_H__
#define __BUOLA_GUI_CCONFIG_H__

#include <buola/gui.h>
#include <unordered_map>

#include <buola/app/cregistry.h>
#include <buola/datetime/clocks.h>
#include <buola/image/cfont.h>
#include <buola/image/ccolor.h>

namespace buola { namespace gui {

class CConfig : public UUncopiable
{
public:
    CConfig() {}

    void Init();

    class SIcons
    {
    public:
        void Init();

        os::CIconTheme *GetTheme()                  {   return mTheme;              }
    private:
        os::CIconTheme *mTheme;
    } mIcons;

    class SMouse
    {
    public:
        void Init();

        chrono::milliseconds GetDoubleClickTime()  {   return mDoubleClickTime;    }
        int GetDoubleClickDistance()    {   return mDoubleClickDistance;    }
        chrono::milliseconds GetDragTime()     {   return mDragTime;               }
        int GetDragDistance()           {   return mDragDistance;           }
        int GetWheelScroll()            {   return mWheelScroll;            }

    private:
        chrono::milliseconds mDoubleClickTime;     //ms
        int mDoubleClickDistance;           //pixels
        chrono::milliseconds mDragTime;            //ms
        int mDragDistance;                  //pixels
        int mWheelScroll;                   //lines
    } mMouse;

    class SKeyboard
    {
    public:
        void Init();

        chrono::milliseconds GetBlinkTime()            {   return mBlinkTime;      }
        chrono::milliseconds GetRepeatDelay()      {   return mRepeatDelay;    }
        chrono::milliseconds GetRepeatTime()           {   return mRepeatTime;     }

    private:
        chrono::milliseconds mBlinkTime;
        chrono::milliseconds mRepeatDelay;
        chrono::milliseconds mRepeatTime;
    } mKeyboard;

    class SColors
    {
    public:
        SColors();
        void Init();
        void InitOne(const CRegistryMap&,const std::wstring&,const img::CColor &pDefault);

        const img::CColor &Get(const std::wstring&);
        const std::unordered_map<std::wstring,img::CColor> &GetAll() {   return mAll;    }

    private:
        std::unordered_map<std::wstring,img::CColor> mAll;
    } mColors;
    
    class SFonts
    {
    public:
        SFonts();
        void Init();
        void InitOne(const CRegistryMap&,const std::wstring&,unsigned int);

        img::PFont Get(const std::wstring&);
        const std::unordered_map<std::wstring,img::PFont> &GetAll() {   return mAll;    }

    private:
        std::unordered_map<std::wstring,img::PFont> mAll;
    } mFonts;
};

extern CConfig gConfig;

/*namespace gui*/ } /*namespace buola*/ }

#endif
